<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <link rel="stylesheet" href="css/common1.css">
    <link rel="stylesheet" href="css/login.css">
    <script src="js/jquery.min.js"></script>
</head>
<body>
    <div class="nav">
        <img src="img/dog.png" alt="">
        <span class="title" style="margin:0px 100px 0px 0px;">智慧公交系统</span>
        <div class="spacer"></div>
    </div>

    <div class="login-container">
        <div class="dialog">
            <h3>登录</h3>
            <div class="row">
                <span>用户名</span>
                <!-- 后面要用,起个id -->
            <input type="text" id="username">
            </div>
            <div class="row">
                <span>旧密码</span>
                <input type="password" id="password">

            </div>
            
            <div class="row">
                <span>新密码</span>
                <input type="password1" id="password1">
            </div>

            <div class="row">
                <button id="login-btn" onclick="subway()">登录</button>
            </div>
        </div>
    </div>
    <script>
        function subway(){
            var username = jQuery("#username");
            var password1 = jQuery("#password1");
                jQuery.ajax({
                url:"/user/update",  
                type:"POST",
                data:{"u_loginName":username.val(),"password1":password1.val()},
                success:function(result){
                    if(result!=null && result.code==200 && result.data!=null){
                        alert("密码修改成功!")
                        location.href = "/login.html";
                    }else{
                        alert("抱歉登录失败，用户名或密码输入错误，请重试！");
                    }
                }
            });
        }

    </script>
</body>
</html>